/***************************************************************************
 *   Copyright (C) 2005 by Andrzej Oczkowicz   
 *   andrew_lz@poczta.fm   
 *                                                                        
 *
 *
 *   kmc - KDE Media Catalog
 *
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *			follow the penguin ;-)
 */


#include <string.h>
#include "dbg.h"

#define _MAX_ERR_DESC 1024

int LAST_ERR;
QString LAST_ERR_STR;
 
int error(int code, const QString&desc)
{
    LAST_ERR = code;
    LAST_ERR_STR = desc;
    if (code !=0 )
      _D << "set LAST_ERROR: " << code << " (" << desc.toAscii() << ")";
    return code;
}

int syserror()
{
  return error(-errno, strerror( errno ) );
}

bool noerror(int code)
{
    return code >= 0;
}

bool iserror()
{
    return LAST_ERR < 0;
}

int lasterror()
{
    return LAST_ERR;
}

QString &errorstr()
{
    return LAST_ERR_STR;
}

char *dbgBacktrace()
{
  return "TODO: BACKTRACE";
}
